home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-09-16 | 19.6 KB | 1,043 lines | [TEXT/CWIE] |
- //
- // CBaseSite.cpp
- //
- // >>> ⌐ 1996-1997 Microsoft Corporation. All rights reserved. <<<
- //
-
- #include "AXContainerHeaders.h"
- #include <ctype.h>
- #include "MacMisc.h"
- #include "CActiveXScheduler.h"
- #include "Helpers.h"
- #include <CodeFragments.h>
- #include "download.h"
-
-
- static LPOLESTR StrDup(LPCOLESTR psz);
- static CCodeDownload* Downloader = NULL;
-
- #pragma mark === CBaseSite::Construction & Destruction ===
-
- /*************************** Construction/Destruction *****************/
-
- //
- // CBaseSite::CreateCBaseSite
- //
-
- CBaseSite *CBaseSite::CreateSite(void)
- {
- return new CBaseSite();
- }
-
-
- //
- // CBaseSite::CBaseSite
- //
-
- CBaseSite::CBaseSite(void)
- {
- mClientSiteID = 0L;
- m_pszCodeURL = NULL;
- m_BaseURL = NULL;
- m_dwMinimumVersion = 0L;
- m_fHaveInitialStream = false;
-
-
- #ifdef PLUGIN_ADAPTER
- m_pInitialDataStreamNotify = NULL;
- m_pUnattachedList = NULL;
- #endif
-
- m_punkObject = NULL;
- m_clsid = CLSID_NULL;
- mUnkOuter = nil;
- mContainerP = nil;
- mContainerData = NULL;
- mObjSiteP = NULL;
- mControlP = NULL;
- mPropertyBagP = NULL;
-
- mCachedDraw = false;
- mCachedContextChange = false;
- mContextIDs = nil;
- mActiveContextID = kAXInvalidContextID;
- mCachedAppState = kAXBeginActivateEventType;
-
- mHavePort = false;
- mOldPortState.ClipRgn = NULL;
- mBindHostP = NULL;
- mNeedLoad = false;
- mDownloadCallbacks.AXGetDownloadPermission = NULL;
- mDownloadCallbacks.AXIsLoaded = NULL;
- }
-
-
- //
- // CBaseSite::~CBaseSite
- //
-
- CBaseSite::~CBaseSite(void)
- {
- #ifdef PLUGIN_ADAPTER
- if (m_pInitialDataStreamNotify != NULL)
- delete m_pInitialDataStreamNotify;
- #endif
- if (m_BaseURL != NULL)
- CoTaskMemFree(m_BaseURL);
- if (m_pszCodeURL != NULL)
- // CoTaskMemFree(m_pszCodeURL);
- DisposePtr(m_pszCodeURL);
-
- if ( mContextIDs )
- delete mContextIDs;
-
- if ( mBindHostP )
- delete mBindHostP;
-
- // Release the container interface
- if ( mContainerP )
- mContainerP->Release();
-
- // Release the unknown outer interface
- if ( mUnkOuter )
- mUnkOuter->Release();
-
- }
-
-
- #pragma mark === CBaseSite::Non Interface public functions ===
-
- //
- // CBaseSite::SetUnkOuter
- //
- // Should be called immediately after creation with an interface
- // that can return an IMacThreadManager interface so
- // code download can access threading service
- //
-
- STDMETHODIMP
- CBaseSite::SetUnkOuter (IUnknown* inUnkOuter)
- {
- UpdateUnkOuter(inUnkOuter);
- return S_OK;
- }
-
-
- //
- // CBaseSite::AddParam
- //
- STDMETHODIMP
- CBaseSite::AddParam (Char8* inName, Char8* inValue)
- {
- LPOLESTR LowerCaseName = StrDup(inName);
- HRESULT hr = S_OK;
-
- if ( LowerCaseName )
- toLower(LowerCaseName);
- else
- return E_OUTOFMEMORY;
-
- if ( !mPropertyBagP )
- {
- if ((mPropertyBagP = new CPropertyBag()) == NULL)
- return E_OUTOFMEMORY;
- }
-
- if (strcmp(LowerCaseName, "codebase") == 0)
- {
- if ((m_pszCodeURL = (LPOLESTR)StrDup((Char8*)inValue)) != NULL)
- {
- GetVersionFromURL(m_pszCodeURL, &m_dwMinimumVersion);
- }
- }
- else if (strcmp(LowerCaseName, "classid") == 0)
- {
- LPOLESTR LowerCaseValue = StrDup((Char8*) inValue);
-
- if ( LowerCaseValue )
- {
- toLower(LowerCaseValue);
- hr = ConvertCLASSIDtoCLSID(LowerCaseValue, &m_clsid);
- DisposePtr(LowerCaseValue);
- }
- }
- else
- {
- mPropertyBagP->AddParam(LowerCaseName, inValue );
- }
- DisposePtr(LowerCaseName);
-
- return hr;
- }
-
- //
- // CBaseSite::CreateControl
- //
-
- STDMETHODIMP
- CBaseSite::CreateControl(void)
- {
- if(!mBindHostP)
- mBindHostP = new CBindHost(this);
-
- return CreateControlInternal(true);
- }
-
- STDMETHODIMP
- CBaseSite::CreateControlInternal(Boolean Initial)
- {
- AXErrorCode Result = S_OK;
- FILEXTN fileType = FILEXTN_UNKNOWN;
- Boolean ConnectionOpen = false;
- CFragConnectionID FragConnection;
-
- if (m_punkObject != NULL)
- return E_ABORT;
-
- if(Initial) // only worry about downloading the first time
- {
- // Attempt to create the object. The latest OLE Controls guidelines only
- // require the object to support IUnknown.
- fileType = GetFileTypeFromExtension(m_pszCodeURL);
-
- if(fileType == FILEXTN_INF || fileType == FILEXTN_HQX)
- {
- if((fileType == FILEXTN_INF) ||
- !CheckCLSIDVersion(m_clsid, m_dwMinimumVersion,
- &ConnectionOpen, &FragConnection))
- {
- if (!Downloader && (Downloader = new CCodeDownload()) == NULL)
- Result = E_FAIL;
- else
- {
- AddRef(); // account for this pointer
- Result = Downloader->QueueDownload(this);
- }
- }
- }
- }
-
- if(Result == S_OK)
- {
- Result = CoCreateInstance(m_clsid, NULL, CLSCTX_INPROC_SERVER,
- IID_IUnknown, (LPVOID *) &m_punkObject);
- }
-
- if(ConnectionOpen)
- {
- CloseConnection (&FragConnection);
- ConnectionOpen = false;
- }
-
- if(mNeedLoad && Result == S_OK)
- Result = LoadControl();
-
- return Result;
- }
-
- STDMETHODIMP
- CBaseSite::LoadControl(void)
- {
- LPUNKNOWN punkPersist;
- HRESULT Result = S_OK;
-
- mNeedLoad = true;
-
- if(m_punkObject)
- {
- mNeedLoad = false; // reinitialize this so site can be reused
-
- // See if this is an in-proc object
- if (SUCCEEDED(m_punkObject->QueryInterface(IID_IObjectWithSite, (LPVOID *) &mObjSiteP)))
- {
- mObjSiteP->SetSite((IUnknown*) (void*) this);
- if (FAILED(m_punkObject->QueryInterface(IID_IControl, (LPVOID *) &mControlP)))
- mControlP = nil;
- }
- else
- mObjSiteP = NULL;
-
- if ( !mControlP )
- goto CreateFailure;
-
- if (SUCCEEDED(m_punkObject->QueryInterface(IID_IPersistPropertyBag,(LPVOID *) &punkPersist)))
- {
- Result = ((LPPERSISTPROPERTYBAG) punkPersist)->Load( mPropertyBagP, NULL);
- punkPersist->Release();
-
- }
- #ifdef PLUGIN_ADAPTER
- else if (m_pInitialDataStreamNotify != NULL &&
- SUCCEEDED(m_punkObject->QueryInterface(IID_IPersistStream,
- (LPVOID *) &punkPersist)))
- {
- m_pInitialDataStreamNotify->m_SeekPosition = sizeof(CLSID);
- Result = ((LPPERSISTSTREAM) punkPersist)->Load((LPSTREAM)
- m_pInitialDataStreamNotify);
- punkPersist->Release();
- }
- delete m_pInitialDataStreamNotify;
- m_pInitialDataStreamNotify = NULL;
- #endif
-
- if (FAILED(Result))
- goto CreateFailure;
-
- if (mCachedAppState != kAXBeginActivateEventType)
- {
- EventRecord TempEvent;
-
- TempEvent.what = osEvt;
- TempEvent.message = suspendResumeMessage << 24;
- if (mCachedAppState == kAXAppActivate)
- TempEvent.message |= resumeFlag;
- TempEvent.when = ::TickCount();
- TempEvent.where.h = TempEvent.where.v = 0;
- TempEvent.modifiers = 0;
-
- mControlP->DoActivate(mCachedAppState, kAXInvalidContextID, &TempEvent);
- }
-
- if ( mCachedContextChange && mContextIDs && mContextIDs->GetCount() > 0 )
- {
- UInt32 ContextID;
- Int32 Index = 0;
-
- while ( GetContextID(++Index, &ContextID))
- {
- mControlP->OnContextChange(ContextID, kAXAddContext);
- if (ContextID == mActiveContextID)
- mControlP->OnContextChange(ContextID, kAXActivateContext);
- }
-
- mCachedContextChange = false;
-
- }
-
- if ( mCachedDraw && mContextIDs && mContextIDs->GetCount() > 0)
- {
- DrawControl();
- mCachedDraw = false;
- }
-
- if(mDownloadCallbacks.AXIsLoaded)
- mDownloadCallbacks.AXIsLoaded(mClientSiteID);
- return S_OK;
- }
- return MK_S_ASYNCHRONOUS;
-
- // Cleanup after anything that we've already done and unload the object.
- CreateFailure:
- DestroyControl();
- return E_FAIL;
-
- }
-
-
- //
- // CBaseSite::DestroyControl
- //
-
- STDMETHODIMP
- CBaseSite::DestroyControl(void)
- {
- if ( mPropertyBagP )
- ReleaseAndNull(mPropertyBagP);
-
- if(mBindHostP != NULL)
- mBindHostP->AbortBindings();
-
- if (mControlP != NULL)
- ReleaseAndNull(mControlP);
-
- if (mObjSiteP != NULL)
- {
- mObjSiteP->SetSite(NULL);
- ReleaseAndNull(mObjSiteP);
- }
-
- SafeReleaseAndNull(m_punkObject);
- CoFreeUnusedLibraries(); // unload the com object if not used
-
- return S_OK;
- }
-
-
- //
- // CBaseSite::SetContainerData
- //
- // Sets the container data for the site
- //
-
- STDMETHODIMP_(Boolean)
- CBaseSite::HasNoStreams(void)
- {
- return mBindHostP ? mBindHostP->GetCount == 0 : true;
- }
-
- //
- // CBaseSite::SetContainerData
- //
- // Sets the container data for the site
- //
-
- STDMETHODIMP
- CBaseSite::SetContainerData(IUnknown* inContainerP, void *inContainerData)
- {
- // Release the current container interface if necessary
- if (mContainerP)
- {
- mContainerP->Release();
- mContainerP = nil;
- mContainerData = 0;
- }
-
- // if we got a new interface, query it for the new container interface
- // and set the container data
- if ( inContainerP )
- {
- inContainerP->QueryInterface(IID_IContainer, &mContainerP);
- mContainerData = inContainerData;
- }
-
-
- return S_OK;
- }
-
-
- //
- // CBaseSite::GetContainerData
- //
- // Returns the container
- //
-
- STDMETHODIMP
- CBaseSite::GetContainerData(void** outContainerData)
- {
- *outContainerData = mContainerData;
- return S_OK;
- }
-
- //
- // CBaseSite::SetBaseURL
- //
- // Sets the base URL for this site
- //
-
- STDMETHODIMP
- CBaseSite::SetBaseURL(Char8* inURL)
- {
- if ( m_BaseURL )
- {
- CoTaskMemFree(m_BaseURL);
- m_BaseURL = nil;
- }
-
- m_BaseURL = OleStrdup(inURL);
-
- return S_OK;
- }
-
- //
- // CBaseSite::GetDownloadPermission
- //
- // all containers MUST OVERRIDE this
- // This function can be called multiple times for controls that
- // have multiple files to download
- Boolean8 CBaseSite::GetDownloadPermission(char* URLString)
- {
- #pragma unused (URLString)
- return true;
- }
-
-
- #pragma mark === CBaseSite::Non Interface protected functions ===
-
-
- //
- // CBaseSite::UpdateUnkOuter
- //
- void CBaseSite::UpdateUnkOuter (IUnknown* inUnkOuter)
- {
- // Release the current UnkOuter if we have one
- if ( mUnkOuter )
- {
- mUnkOuter->Release();
- mUnkOuter = nil;
- }
-
- // if we got a new outer unknown, record it and addref it
- if ( inUnkOuter )
- {
- mUnkOuter = inUnkOuter;
- mUnkOuter->AddRef();
- }
- }
-
- //
- // CBaseSite::DrawControl
- //
-
- void CBaseSite::DrawControl(void)
- {
- if ( mControlP )
- {
- AXDrawContext Context = {kAXBeginPortType};
- UInt32 ContextID;
- long Index = 1;
-
- while( GetContextID(Index++, &ContextID) )
- {
- if(AcquireContext(ContextID, &Context) == S_OK)
- {
- mControlP->Draw(&Context);
- ReleaseContext(&Context);
- }
- }
- }
- else
- mCachedDraw = true;
- }
-
-
- //
- // CBaseSite::SavePortState
- //
-
- void CBaseSite::SavePortState(AXPlatformPort* Port)
- {
- // Save off the current port
- ::GetPort(&mSavePort);
-
- // Set the current port to the one requested
- ::SetPort(Port);
-
- // Save off the port rect and clip
- mOldPortState.PortRect = Port->portRect;
- mOldPortState.ClipRgn = NewRgn();
- ::GetClip(mOldPortState.ClipRgn);
-
- // Save off the pen state
- ::GetPenState(&mOldPortState.PenState);
- mOldPortState.TextFont = Port->txFont;
- mOldPortState.TextMode = Port->txMode;
- mOldPortState.TextSize = Port->txSize;
- mOldPortState.TextFace = Port->txFace;
- ::GetForeColor(&mOldPortState.ForeColor);
- ::GetBackColor(&mOldPortState.BackColor);
- }
-
-
- //
- // CBaseSite::RestorePortState
- //
-
- void CBaseSite::RestorePortState(void)
- {
- // Undo everything we did to "thePort" in AcquirePort.
- ::SetOrigin(mOldPortState.PortRect.left, mOldPortState.PortRect.top);
- if (mOldPortState.ClipRgn)
- {
- ::SetClip(mOldPortState.ClipRgn);
- ::DisposeRgn(mOldPortState.ClipRgn);
- mOldPortState.ClipRgn = NULL;
- }
-
- // Restore the current state of things
- ::SetPenState(&mOldPortState.PenState);
- ::TextFont(mOldPortState.TextFont);
- ::TextFace(mOldPortState.TextFace);
- ::TextMode(mOldPortState.TextMode);
- ::TextSize(mOldPortState.TextSize);
- ::RGBForeColor(&mOldPortState.ForeColor);
- ::RGBBackColor(&mOldPortState.BackColor);
-
- // Set back to original port
- ::SetPort(mSavePort);
-
- }
-
-
- //
- // CBaseSite::GetContextID
- //
- // all containers MUST OVERRIDE this
-
- Boolean8
- CBaseSite::GetContextID(Int32 inContextIndex, UInt32* outContextID)
- {
- #pragma unused (inContextIndex, outContextID)
- return false;
- }
-
- #pragma mark === CBaseSite::IUnknown Interfaces ===
-
- /************************* IUnknown Interfaces *************************/
- //
- // CBaseSite::IUnknown::QueryInterface
- //
- // Returns a pointer to the specified interface on a component to which a
- // client currently holds an interface pointer.
- //
- STDMETHODIMP
- CBaseSite::QueryInterface(REFIID inRefID, void** outObj)
- {
- AXErrorCode Result = CBaseCOM::QueryInterface( inRefID, outObj);
-
- if ( Result == E_NOINTERFACE )
- {
- void* pv = nil;
-
- if ( inRefID == IID_IControl )
- pv = (void*)(IControl*) this;
- else if ( inRefID == IID_IContainerSite )
- pv = (void*)(IContainerSite*) this;
- else if (inRefID == IID_IServiceProvider)
- pv = (void*)(LPSERVICEPROVIDER) this;
- else if (inRefID == IID_IBindHost)
- {
- if(!mBindHostP)
- mBindHostP = new CBindHost(this);
- pv = (void*)(LPBINDHOST) mBindHostP;
- }
- else if ( mUnkOuter ) // Check the outer unknown
- {
- Result = mUnkOuter->QueryInterface(inRefID, outObj);
- if ( Result == S_OK )
- return Result;
- }
-
- *outObj = pv;
-
- if ( pv )
- {
- ((IUnknown*) pv)->AddRef();
- Result = S_OK;
- }
- }
-
- return Result;
-
- }
-
-
-
- #pragma mark === CBaseSite::IContainerSite Interfaces ===
-
- //
- // CBaseSite::IContainerSite::GetContainer
- //
- // Returns the container
- //
-
- STDMETHODIMP
- CBaseSite::GetContainer(IContainer** outContainer)
- {
- // Caller's responsibility to AddRef the container interface
- *outContainer = mContainerP;
- return S_OK;
- }
-
-
- //
- // CBaseSite::IContainerSite::RequestFocus
- //
- // attempt to manage focus
- //
-
- STDMETHODIMP
- CBaseSite::RequestFocus ( Boolean8 /* inAcquire */, AXFocusSet /* inFocus */)
- {
- return E_NOTIMPL;
- }
-
-
- //
- // CBaseSite::RequestSizeChange
- //
- // how to change the controls size
- //
-
- STDMETHODIMP
- CBaseSite::RequestSizeChange ( Point* /* ioSize */)
- {
- return E_NOTIMPL;
- }
-
- //
- // CBaseSite::OnChange
- //
- // Notification that something of interest changed in the control
- //
-
- STDMETHODIMP
- CBaseSite::OnChange (AXChangeType inChangeType)
- {
- switch (inChangeType)
- {
- case kAXUsedAreaChange:
- {
- AXDrawContext Context = {kAXBeginPortType};
- UInt32 ContextID;
- long Index = 1;
-
- while( GetContextID(Index++, &ContextID) )
- {
- AcquireContext(ContextID, &Context);
- ::EraseRect(&Context.Location);
- ReleaseContext(&Context);
- }
- }
- break;
- case kAXViewChange:
- case kAXDataChange:
- default:
- break;
- }
-
- return S_OK; // we don't care here
- }
-
- //
- // CBaseSite::IContainerSite::AcquireContext
- //
-
- STDMETHODIMP
- CBaseSite::AcquireContext(Uint32 /*inContextID*/, AXDrawContext* /*outContext*/)
- {
- return E_FAIL;
- }
-
-
- //
- // CBaseSite::IContainerSite::ReleaseContext
- //
-
- STDMETHODIMP
- CBaseSite::ReleaseContext(AXDrawContext* inContext)
- {
- #pragma unused (inContext)
-
- if (!mHavePort)
- {
- // Unbalanced GetDC/ReleaseDC calls. Return an error.
- return E_FAIL;
- }
-
- RestorePortState();
-
- mHavePort = FALSE;
-
- return S_OK;
- }
-
-
- //
- // CBaseSite::IContainerSite::SetIdleTime
- //
-
- STDMETHODIMP
- CBaseSite::SetIdleTime(Int32 inWaitTicks, Uint32 inRefCon)
- {
- CActiveXScheduler* Scheduler = CActiveXScheduler::GetActiveXScheduler(true);
- AXErrorCode Result = E_FAIL;
-
- if (Scheduler)
- {
- if (inWaitTicks == kAXRemoveAllIdlers)
- Result = Scheduler->RemoveControl(this);
- else if (inWaitTicks == kAXRemoveIdler)
- Result = Scheduler->RemoveControlByRefCon(this, inRefCon);
- else
- {
- Result = Scheduler->ScheduleControl(inWaitTicks == kAXIdleAfterAllEvents, inWaitTicks, this, inRefCon);
- }
- }
-
- return Result;
- }
-
-
-
- #pragma mark === CBaseSite::IControl Interfaces ===
-
- //
- // CBaseSite::IControl::Draw
- //
- // Calls the embedded object and tells it to paint itself.
- //
-
- STDMETHODIMP
- CBaseSite::Draw(AXDrawContext* inContext)
- {
- if ( mControlP )
- mControlP->Draw(inContext);
- else
- mCachedDraw = true;
-
- return S_OK;
- }
-
-
- //
- // CBaseSite::IControl::OnContextChange
- //
- // Adds a context to the control
- //
-
- STDMETHODIMP
- CBaseSite::OnContextChange(UInt32 inContextID, AXContextCommand inCommand)
- {
- // if the context IDs list has not been created, create it
- if ( !mContextIDs )
- {
- mContextIDs = new LArray(sizeof(Uint32));
- if ( !mContextIDs )
- return E_FAIL;
- }
-
- // Update our list of context IDs appropriately
- switch ( inCommand )
- {
- case kAXAddContext:
- mContextIDs->InsertItemsAt(1, 0x7fffffff, &inContextID);
- break;
-
- case kAXRemoveContext:
- mContextIDs->Remove(&inContextID);
- break;
-
- case kAXActivateContext:
- mActiveContextID = inContextID;
- break;
-
- case kAXDeactivateContext:
- mActiveContextID = kAXInvalidContextID;
- break;
-
- }
-
- // if we have a control, let it handle the context change
- // otherwise, we cache the context change
- if ( mControlP )
- {
- AXErrorCode err = mControlP->OnContextChange(inContextID, inCommand);
-
- // if we still have a pending cached draw, clear out here
- if ( err == S_OK && mCachedDraw && inCommand == kAXActivateContext )
- {
- DrawControl();
- mCachedDraw = false;
- }
-
- mCachedContextChange = false; // Once we have a control, no need to have this flag set any more
-
- return err;
-
- }
- else
- {
- if ( inCommand == kAXAddContext || inCommand == kAXActivateContext )
- mCachedContextChange = true;
- return S_OK;
- }
- }
-
-
- //
- // CBaseSite::IControl::GetID
- //
- // Returns the ID of the control
- //
-
- STDMETHODIMP
- CBaseSite::GetID(Int32 inBufferSize, Char8* outID)
- {
- if ( mControlP )
- return mControlP->GetID(inBufferSize, outID);
- else
- {
- outID[0] = 0; // return null string
- return E_FAIL;
- }
- }
-
- //
- // CBaseSite::IControl::GetUsedArea
- //
- // Returns the used area of the control
- //
-
- STDMETHODIMP
- CBaseSite::GetUsedArea(AXPlatformRegion* outUsedArea)
- {
- if ( mControlP )
- return mControlP->GetUsedArea(outUsedArea);
- else
- return E_FAIL;
- }
-
- //
- // CBaseSite::IControl::SetFocus
- //
- // Sets or removes focus from this site
- //
-
- STDMETHODIMP
- CBaseSite::SetFocus(AXFocusCommand inCommand, AXFocusSet inFocus)
- {
- AXErrorCode theResult = S_OK;
-
- if ( mControlP )
- theResult = mControlP->SetFocus(inCommand, inFocus);
- else
- theResult = E_FAIL;
-
- return theResult;
- }
-
-
- //
- // CBaseSite::IControl::DoMouse
- //
-
- STDMETHODIMP
- CBaseSite::DoMouse(AXMouseEventType inMouseET, AXPlatformEvent* inEvent)
- {
- AXErrorCode theResult = S_OK;
-
- if ( mControlP )
- theResult = mControlP->DoMouse(inMouseET, inEvent);
-
- return theResult;
- }
-
-
- //
- // CBaseSite::IControl::DoKey
- //
-
- STDMETHODIMP
- CBaseSite::DoKey(AXKeyEventType inKeyET, Char8 inChar, AXPlatformEvent* inEvent)
- {
- AXErrorCode theResult = S_OK;
-
- if ( mControlP )
- theResult = mControlP->DoKey(inKeyET, inChar, inEvent);
-
- return theResult;
- }
-
-
- //
- // CBaseSite::IControl::DoActivate
- //
-
- STDMETHODIMP
- CBaseSite::DoActivate(AXActivateEventType inActiveET, UInt32 inContextID, AXPlatformEvent* inEvent)
- {
- AXErrorCode theResult = S_OK;
-
- if ( mControlP )
- theResult = mControlP->DoActivate(inActiveET, inContextID, inEvent);
- else
- {
- switch (inActiveET)
- {
- case kAXAppActivate:
- case kAXAppDeactivate:
- mCachedAppState = inActiveET;
- break;
- case kAXWindowActivate:
- case kAXWindowDeactivate:
- break;
- default:
- break;
- }
- }
-
- return theResult;
- }
-
-
- //
- // CBaseSite::IControl::DoSystemEvent
- //
-
- STDMETHODIMP
- CBaseSite::DoSystemEvent(AXPlatformEvent* inEvent)
- {
- AXErrorCode theResult = S_OK;
-
- if ( mControlP )
- theResult = mControlP->DoSystemEvent(inEvent);
-
- return theResult;
- }
-
-
- //
- // CBaseSite::IControl::OnIdle
- //
- // pass idle events to the control
- //
-
- STDMETHODIMP
- CBaseSite::DoIdle(Uint32 IdleRefCon)
- {
- if ( mControlP )
- return mControlP->DoIdle(IdleRefCon);
- else
- return SetIdleTime(kAXRemoveAllIdlers, NULL);
- }
-
-
- #pragma mark === CBaseSite::IServiceProvider Interface ===
-
- //
- // CBaseSite::IServiceProvider::QueryService
- //
-
- STDMETHODIMP
- CBaseSite::QueryService(REFGUID inRSID, REFIID inRefID, void** outObj)
- {
- AXErrorCode Result;
-
- if (inRSID == SID_BindHost)
- {
- // According to the "OLE Controls/COM Objects for the Internet" spec,
- // it's legal for the site to implement this service directly on the
- // site object.
- Result = QueryInterface(inRefID, outObj);
- }
- else
- {
- *outObj = NULL;
- Result = E_NOINTERFACE;
- }
-
- return Result;
- }
-
-
-
-
-
- #pragma mark === Static Utility Functions ===
-
- //
- // StrDup
- //
-
- static LPOLESTR StrDup(LPCOLESTR psz)
- {
- LPOLESTR pszDup;
-
- if ((pszDup = (LPOLESTR) NewPtr(strlen((char *) psz) + 1)) != NULL)
- strcpy((char *) pszDup, (const char *) psz);
-
- return pszDup;
- }
-
-
-